module.exports = ctx => ({
  base: '/',
  dest: '/dist',
  locales: {
    '/': {
      lang: 'zh-CN',
      title: '.NET 文档',
      description: '简单地说，.NET Core 是一个跨平台的开放源代码 .NET 实现。'
    },
  },
  head: [
    ['link', { rel: 'icon', href: `/logo_vs-mac.svg` }],
    ['link', { rel: 'manifest', href: '/manifest.json' }],
    ['meta', { name: 'theme-color', content: '#3eaf7c' }],
    ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
    ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
    ['meta', { name: 'msapplication-TileColor', content: '#000000' }]
  ],
  themeConfig: {
    repo: 'wongsi/dotnet',
    editLinks: true,
    docsRepo: 'wongsi/dotnet',
    docsDir: 'dotnet',
    locales: {
      '/': {
        label: '简体中文',
        selectText: '选择语言',
        editLinkText: '在 GitHub 上编辑此页',
        lastUpdated: '上次更新',
        nav: require('./nav/zh-hans'),
        sidebar: {
          '/': getSidebar('入门', '.NET Core', '.NET Framework', 'Visual Studio Code')
        }
      },
    }
  },
  plugins: [
    ['@vuepress/back-to-top', true],
    ['@vuepress/pwa', {
      serviceWorker: true,
      updatePopup: true
    }],
    ['@vuepress/medium-zoom', true]
  ],
  extraWatchFiles: [
    '.vuepress/nav/zh-hans.js',
  ]
})

function getSidebar(groupA, groupB, groupC, groupD) {
  return [
    {
      title: groupA,
      collapsable: false,
      children: [
        '',
      ]
    },
    {
      title: groupB,
      collapsable: false,
      children: [
        'DotNetCore/Service',
      ]
    },
    {
      title: groupC,
      collapsable: false,
      children: [
        'DotNetFramework/',
      ]
    },
    {
      title: groupD,
      collapsable: false,
      children: [
        'vscode.extensions',
        'vscode.settings'
      ]
    },
  ]
}
